<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of RepoAuditCargosImpl
 *
 * @author EADeveloper
 */
class RepoEcImpl extends ReportDoc {

    function __construct() {
         $this->fields = array(array("label" => "NO. CTA.", "name" => "FK_CUENTA", "type" => ReportDoc::$TIPO_LETRA, "width" => 13),
          array("label" => "FECHA", "name" => "FECHA", "type" => ReportDoc::$TIPO_LETRA, "width" => 20),
          array("label" => "DESCRIPCION", "name" => "DESCRIPCION", "type" => ReportDoc::$TIPO_LETRA, "width" => 80),
          array("label" => "FECHA", "name" => "FECHA", "type" => ReportDoc::$TIPO_LETRA, "width" => 20),
          array("label" => "DEBE", "name" => "DEBE", "type" => ReportDoc::$TIPO_NUMERICO, "width" => 20),
          array("label" => "HABER", "name" => "HABER", "type" => ReportDoc::$TIPO_NUMERICO, "width" => 20),
          array("label" => "SALDO", "name" => "SALDO", "type" => ReportDoc::$TIPO_NUMERICO, "width" => 20));
         
        $this->callbackSql = "cbSqlRepEC"; //funcion que genera sql
        $this->callbackRow = NULL; //funcion para cada fila generada

        $this->paramPage = "reportes/ rpt_estado_cuenta_param.php";
        $this->resultPage = "reportes/rpt_estado_cuenta_resultado.php";
        $this->rootPath = MODULES . DS;
        $this->key = "estadocuentas";
        $this->label = "Estado de Cuenta";
        $this->tipoEjecucion = "D";
        $this->orientacion = "P";
        $this->printers = array("excel" => array("name" => "EaExcelPrinter",
                "label" => "Excel",
                "icon" => "excel.png", "source" => $this->key),
            "pdf" => array("name" => "EaPdfPrinter",
                "label" => "Pdf", "icon" => "pdf.png", "source" => $this->key));
    }

    /**
     * Devuelve el estado de cuenta en base a un codigo
     */
    public function cbSqlRepEC() {
        $id = getParam("hdnCodigo");
        $tipo = getParam("tipoconsulta");
        $tipo = $tipo == "1" ? "FK_ESTUDIANTE" : "FK_BENEFACTOR";
        $sql = " select $tipo AS FK_CUENTA,FECHA,DESCRIPCION,DEBE,HABER,SALDO from cllg_movs_cuenta
                    WHERE $tipo=$id ORDER BY ID,FECHA";
        $this->lastQuery = $sql;
    }
}
?>
